package com.zlq.cn.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zlq.cn.api.SignApiResult;
import com.zlq.cn.entity.XinGaiNian;
import com.zlq.cn.service.un.XinGaiNianService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 新概念 前端控制器
 * </p>
 *
 * @author zhoucl
 * @since 2024-03-09
 */
@Api(tags = "公共-新概念")
@RestController
@RequestMapping("/api/common/xinGaiNian")
public class XinGaiNianController {
    @Resource
    private XinGaiNianService xinGaiNianService;

    @ApiOperation("新概念列表")
    @GetMapping("/list")
    public SignApiResult<Page<XinGaiNian>> list(Page<XinGaiNian> page, XinGaiNian xinGaiNian) {
        xinGaiNianService.lambdaQuery()
                .eq(StringUtils.isNotEmpty(xinGaiNian.getType()), XinGaiNian::getType, xinGaiNian.getType())
                .eq(StringUtils.isNotEmpty(xinGaiNian.getBook()), XinGaiNian::getBook, xinGaiNian.getBook())
                .eq(StringUtils.isNotEmpty(xinGaiNian.getFileType()), XinGaiNian::getFileType, xinGaiNian.getFileType())
                .like(StringUtils.isNotEmpty(xinGaiNian.getFileName()), XinGaiNian::getFileName, xinGaiNian.getFileName())
                .orderByAsc(XinGaiNian::getFileName)
                .page(page);
        return SignApiResult.resultSuccess(page);
    }
}

